<template>
  <basic-container>
    <div slot="header"><span>参数管理</span></div>
    <avue-crud :option="option"
               :table-loading="loading"
               :data="dataList"
               :page.sync="page"
               :permission="permissionList"
               v-model="form"
               ref="crud"
               @row-save="rowSave"
               @row-update="rowUpdate"
               @row-del="rowDel"
               :before-open="beforeOpen"
               @search-change="searchChange"
               @search-reset="searchReset"
               @selection-change="selectionChange"
               @current-change="currentChange"
               @size-change="sizeChange"
               @refresh-change="refreshChange"
               @on-load="onLoad">
      <template slot-scope="{ row }" slot="status">
        <el-switch
            v-model="row.status"
            class="switch"
            :active-value="1"
            :inactive-value="0"
            active-text="开启"
            inactive-text="停用"
            @change="update(row)"/>
      </template>
    </avue-crud>

  </basic-container>
</template>



<script>
import {mixins} from '@/mixins/crud'
import {getList,remove,add,update} from '@/api/system/param'
export default {
  components: {},
  mixins:[mixins],
  data() {
    return {
      events: {
        remove: remove,
        update: update,
        add: add,
        getList: getList,
      },
      storeList:[],
      option: {
        height: 'auto',
        calcHeight: 30,
        tip: false,
        searchShow: true,
        searchMenuSpan: 6,
        border: true,
        index: true,
        viewBtn: false,
        addBtn: true,
        searchBtn: true,
        delBtn: true,
        editBtn: true,
        selection: true,
        menuWidth: 180,
        labelWidth: 100,
        align: 'center',
        refreshBtn:true,
        searchShowBtn:true,
        columnBtn:true,
        dialogWidth: '40%',
        column: [
          {
            label: "参数名",
            prop: "paramName",
            span: 24,
          },
          {
            label: "参数键",
            prop: "paramKey",
            span: 24,
          },
          {
            label: "参数值",
            prop: "paramValue",
            span: 24,
          },
          {
            label: "状态",
            prop: "status",
            editDisplay:false,
            addDisplay:false,
          },
          {
            label: "备注",
            prop: "remark",
            type:'textarea',
            span: 24,
          },
        ]
      },
    };
  },

  mounted() {

  },


  methods: {
    update(row){
      update(row).then(()=>{
        this.onLoad(this.page);
      })
    }
  }
};


</script>

<style scoped>

</style>

